<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Front extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('file');
       // $this->load->helper('fuc');
       // $this->load->library('topclass');
       // $this->load->library('session_db');
       // $this->load->model('generat_array');
        $this->load->database();
       // $this->load->model("auth_handle");
       // $this->config->load('topapiconfig');
    }


	/* ====淘宝iframe中的地址
		
		http://container.api.taobao.com/container?
		appkey=21104397
		&seller_nick=幻想de味道
		&envMode=edit
		&module_width=750
		&shop_id=34905576
		
		====回调后的地址========================
		http://100.ipropre.com/index.php/front?top_appkey=21104397&top_parameters=aWZyYW1lPTEmdHM9MTM0OTQ4ODExNTIzMCZ2aXNpdG9yX2lkPTcyNjA4MTgwJnZpc2l0b3Jfbmljaz27w8%2FrZGXOtrXA&top_session=&module_width=750&envMode=prod&shop_id=34905576&seller_nick=%E5%B9%BB%E6%83%B3de%E5%91%B3%E9%81%93&top_sign=S5Sv3JTJKI%2FgzvWYQqeZTw%3D%3D
		
		http://100.iporpre.com/index.php/front?
		top_appkey=12481890
		&top_parameters=aWZyYW1lPTEmdHM9MTM0NjgxMTQ2MjY4OCZ2aXNpdG9yX2lkPTcyNjA4MTgwJnZpc2l0b3Jfbmljaz27w8%2FrZGXOtrXA&top_session=
		&module_width=190
		&envMode=prod
		&shop_id=73296719
		&seller_nick=幻想de味道
		&top_sign=NJrHXJii4W7V777NDQLgcg%3D%3D
		
		echo base64_decode('aWZyYW1lPTEmdHM9MTM0NjgxMTQ2MjY4OCZ2aXNpdG9yX2lkPTcyNjA4MTgwJnZpc2l0b3Jfbmljaz27w8%2FrZGXOtrXA');
		iframe=1&ts=1346811462688&visitor_id=72608180&visitor_nick=紫色color 
	*/
	
    public function index() {
		//echo $_GET["shop_id"];
		$data['shop_id'] = $shop_id = $_GET["shop_id"];
		$data['width'] = $module_width = $_GET["module_width"];
		
		$this->db->where('shop_id',$shop_id);
		$user = $this->db->get('user');
		if($user->num_rows() > 0) :
			$user = $user->row_array();
			$user_id = $user['user_id'];
			$this->db->where('user_id',$user_id);
			$config = $this->db->get('config');
			if($config->num_rows() > 0){
					$data['configseting'] = $config->row_array();
				}else{
					$data['configseting'] = array(
											'style_id' => 1,
											'min_txt_num' => 5,
											'visual' => 1,
											'intervall' => 50
										);
				}
			$this->db->where('shop_id',$shop_id);
			$code = $this->db->get('wallcode');
			if($code->num_rows() > 0){
				$wallcode = $code->row_array();
				$data["commnetwall"] = unserialize($wallcode['codearray']);
				$this->load->view('front_view',$data);
			}else{
				$this->load->view('welcome_message',$data);
			}
		else : 
			$this->load->view('welcome_message',$data);
		endif;
    }


}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
//http://100.ipropre.com/index.php/front?top_appkey=12481890&module_width=750&envMode=prod&shop_id=34905576&seller_nick=幻想de味道